package com.liaogui.内部类;

/**
 * @author liaogui
 * @date 2025/4/13 13:24
 */
public class 局部内部类 {
    private String outerVariable = "Outer Variable";

    private void setOuterVariable() {
        System.out.println(outerVariable);
    }
    void outerMethod() {
        String localVar = "Local Variable";

        class LocalInnerClass {
            void display() {
                setOuterVariable();
                System.out.println(outerVariable);
                System.out.println(localVar);
            }
        }
        LocalInnerClass localInnerClass = new LocalInnerClass();
        localInnerClass.display();
    }

    public static void main(String[] args) {
        局部内部类 局部内部类 = new 局部内部类();
        局部内部类.outerMethod();

    }

}
